<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%String path = request.getContextPath();%>

<html>
<head>
	<meta http-equiv="pragma" content="no-cache"/>
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0"/>    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
	<meta http-equiv="description" content="This is my page"/>
	
	<style>

    </style>
    
    <script type='text/javascript' src='<%=path %>/dwr/interface/loginService.js'></script>
	<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
	<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
    
    <script type="text/javascript">
       function check1()
		 {                                                                                         
		     if(document.ThisForm.userName.value=="")
			 {
			 	alert("请输入账号");
				document.ThisForm.userName.focus();
				return false;
			 }
			 if(document.ThisForm.userPw.value=="")
			 {
			 	alert("请输入密码");
				document.ThisForm.userPw.focus();
				return false;
			 }
			 document.getElementById("indicator").style.display="block";
			 loginService.login(document.ThisForm.userName.value,document.ThisForm.userPw.value,document.ThisForm.userType.value,callback);
		 }
		
		 function callback(data)
		 {
		    document.getElementById("indicator").style.display="none";
		    if(data=="no")
		    {
		        alert("账号或密码错误");
		    }
		    if(data=="yes")
		    {
		        alert("通过验证,系统登录成功");
		        window.location.href="<%=path %>/loginSuccess.jsp";
		    }
		 }
    </script>
</head>
  
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" scroll="no">
<form name="ThisForm" action="" method="post">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="100%" align="center" bgcolor="#e3efff">
    <table width="990" height="305" border="0" cellpadding="0" cellspacing="0" background="images/loginBg.png">
      <tr>
        <td><table border="0" align="center" cellpadding="0" cellspacing="7">
          <tr>
            <td>账号：</td>
            <td><input name="userName" type="text" style="width:160px;hight:20px"></td>
            </tr>
          <tr>
            <td>密码：</td>
            <td><input name="userPw" type="password" style="width:160px;hight:20px"></td>
            </tr>
            <tr>
            <td style="display: none;">类型：</td>
            <td style="display: none;">
                <select name="userType" style="width: 160px;">
				    <option value="0">0</option>
				    <option value="2">2</option>
				</select>
            </td>
            </tr>
          <tr>
            <td height="100" colspan="2" valign="top"><table border="0" align="center" cellpadding="0" cellspacing="5">
              <tr>
                <td align="center">
                   <input type="button" value="登录" onclick="check1()" style="width: 80px;font-size: 15px;margin-left: 50px;"/>
                   <input type="reset" value="重置" style="width: 80px;font-size: 15px;"/>
                   <img id="indicator" src="<%=path %>/img/loading.gif" style="display:none"/>
                </td>
              </tr>
            </table></td>
            </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>
